@extends('master')
@section('title', trans('corebg.users.show.title'))
@section('content')
<div class="container col-md-6 col-md-offset-3">
  <div class="card mt-5">
      <div class="card-header">
          <h5 class="float-left">{{ trans('corebg.users.show.title') }}
            <a href="{{ $backurl }}">
              <span class="fas fa-arrow-circle-left" style="cursor:pointer" title="{{ trans('corebg.backurl') }}" >
              </span>
            </a>
          </h5>
      </div>
      <div class="card-body">
          <form class="form-horizontal" action="/users/{{$resource['id']}}" method="post">
              @include('shared.error-messages')
              @include('shared.flash-messages')
              {{ csrf_field() }}
              {{ method_field('PUT') }}

              <div class="form-group">
                <label for="name" class="col-lg-12 control-label">{{ trans('corebg.users.show.name') }}</label>
                <div class="col-lg-12">
                    <input type="text" class="form-control" id="name" name="name" value="{{ $resource['name'] }}" >
                </div>
              </div>
              <div class="form-group">
                  <label for="email" class="col-lg-12 control-label">{{ trans('corebg.users.show.email') }}</label>
                  <div class="col-lg-12">
                      <input type="text" class="form-control" id="email" name="email" value="{{ $resource['email'] }}" readonly >
                  </div>
              </div>

              <div class="form-group">
                <label for="registered" class="col-lg-12 control-label">{{ trans('corebg.users.show.registered') }}</label>
                <div class="col-lg-12">
                  @isset($resource['registered'])
                    @if ($resource['registered'])
                      <b>{{ trans('corebg.yes') }}</b>
                    @else
                      <b>{{ trans('corebg.no') }}</b>
                    @endif
                  @endisset
                </div>
              </div>

              <div class="form-group">
                <label for="email_verified_at" class="col-lg-12 control-label">{{ trans('corebg.users.show.email_verified_at') }}</label>
                <div class="col-lg-12">
                    <input type="text" class="form-control" id="email_verified_at" name="email_verified_at" value="{{ $resource['email_verified_at'] }}" readonly >
                </div>
              </div>
              <div class="form-group">
                <label for="last_login_at" class="col-lg-12 control-label">{{ trans('corebg.users.show.last_login_at') }}</label>
                <div class="col-lg-12">
                    <input type="text" class="form-control" id="last_login_at" name="last_login_at" value="{{ $resource['last_login_at'] }}" readonly>
                </div>
              </div>
              <div class="form-group">
                <label for="last_logout_at" class="col-lg-12 control-label">{{ trans('corebg.users.show.last_logout_at') }}</label>
                <div class="col-lg-12">
                    <input type="text" class="form-control" id="last_logout_at" name="last_logout_at" value="{{ $resource['last_logout_at'] }}" readonly>
                </div>
              </div>

              <!-- Role -->
              @isset ($resource['role'])
                <hr>
                @include('shared.roles')
              @endisset

              <!-- Person -->
              @isset ($resource['person'])
                <hr>
                <div class="form-group">
                  <label for="person" class="col-lg-12 control-label">{{ trans('corebg.users.show.person') }}</label>
                  <div class="col-lg-12">
                      <input type="text" class="form-control" id="person" name="person" value="{{ $resource['person']['name'] }} {{ $resource['person']['surname'] }}" readonly>
                      <input type="hidden" id="person_id" name="person_id" value="{{ $resource['person']['id'] }}" >
                  </div>
                </div>
              @endisset

              <!-- Company -->
              @isset ($resource['company'])
                <hr>
                <div class="form-group">
                  <label for="company" class="col-lg-12 control-label">{{ trans('corebg.users.show.company') }}</label>
                  <div class="col-lg-12">
                      <input type="text" class="form-control" id="company" name="company" value="{{ $resource['company']['businessname'] }}" readonly>
                      <input type="hidde" id="company_id" name="company_id" value="{{ $resource['company']['id'] }} " >
                  </div>
                </div>
              @endisset

              <!-- Picture -->
              @isset ($resource['picture'])
                <hr>
                <div class="form-group">
                  <label for="picture" class="col-lg-12 control-label">{{ trans('corebg.users.show.picture') }}</label>
                  <div class="col-lg-12">
                    <img src="data:{{ $resource['picture']['mime_type'] }};base64,{{ $resource['picture']['image'] }}" alt="{{ $resource['picture']['title'] }}" />
                    <input type="hidden" id="picture_id" name="picture_id" value="{{ $resource['picture']['id'] }} " >
                  </div>
                </div>
              @endisset

              <!-- Common Properties -->
              <hr>
              @include('shared.common-properties')

              <div class="form-group">
                <div class="col-lg-12">
                  <button type="submit" class="btn btn-primary">{{ trans('corebg.save') }}</button>
                </div>
              </div>

          </form>
      </div>
  </div>
</div>
@endsection
